/**
 * 
 */
package com.aranin.weblog4j.hashdb;

import java.util.HashMap;

import com.aranin.weblog4j.vo.BookVO;


/**
 * @author stage1
 *
 */

public class HashDB {
    public static HashMap<String, BookVO> bookDB = new HashMap<String, BookVO>();
    public static int counter = 0;
    public static void insertBook(BookVO bookVO){
        if(HashDB.bookDB.size() > 10000){
             HashDB.bookDB.clear();
             counter++;
        }
        HashDB.bookDB.put(bookVO.getBookName(), bookVO);
        System.out.println("--------------------");
        for(java.util.Map.Entry<String, BookVO> entry : bookDB.entrySet()) {
        	String cle = entry.getKey();
        	BookVO valeur = entry.getValue();
        	System.out.println(cle+"..."+valeur.getBookId()+"..."+valeur.getBookName()+"..."+valeur.getAuthor());
            
        }
        System.out.println("--------------------");
    }

    public static BookVO getBook(String bookName){
        return HashDB.bookDB.get(bookName);
    }

}